import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './vuex/store'
import './registerServiceWorker'
import 'reset-css';

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);

import '@/mixins/mixins'

import '@/assets/CSS/font-awesome.css'
import '@/assets/CSS/style.css'
import '@/utils/axios'
import '@/apis'


Vue.config.productionTip = false

router.beforeEach((to,from,next)=>{
  // console.log(to);
  if(to.path==='/Signin'){
    localStorage.clear();
    next();
  }else{
    if (localStorage.getItem("token")) {
      next();
    }else{
      next({path:'/Signin',query:{redirect:to.path}})
    }
  }
  next();
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
 